package com.lanou3g.code0426;

import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by dllo on 18/4/26.
 */
public class Test03 {

    public static void main(String[] args) {
        String sql = "DELETE FROM stu WHERE sname = '嘿嘿'";
        Statement statement = JDBCUtil.getStatement();
        //代理模式解决try-catch

        try {
            int rows = statement.executeUpdate(sql);
            if (rows > 0){
                System.out.println("成功");
            }else{
                System.out.println("失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


        JDBCUtil.closeResource(statement);  //关闭资源
        JDBCUtil.closeConn(); //放在main方法的最后一行,整个项目写一遍就可以了,别写太多,千万别写太多:连接已关闭
    }




}
